﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ImageRecognition2.MouseImageTools
{
    //TODO: clicking on an empty point on the screen doesn't really reset the selection.
    /// <summary>
    /// This is used to create a selection. See also "CSelector" <seealso cref="CSelector"/>
    /// to see how this is done.
    /// </summary>
    public class SelectionTool : MouseImageTool
    {
        #region Declarations
        private Selector m_Selector = null;
        #endregion Declarations

        #region Constructors

        /// <summary>
        /// 
        /// </summary>
        /// <param name="_control"></param>
        public SelectionTool(Control _control)
            : base(_control)
        {
            InitName();
            this.m_Selector = new Selector(_control);
        }
        #endregion Constructors

        #region Events
        /// <summary>
        /// Called when [mouse up].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        public override void OnMouseUp(object sender, MouseEventArgs e)
        {
            base.OnMouseUp(sender, e);
            this.m_Selector.OnMouseUp(sender, e);
        }

        /// <summary>
        /// Called when [mouse down].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        public override void OnMouseDown(object sender, MouseEventArgs e)
        {
            base.OnMouseDown(sender, e);
            this.m_Selector.OnMouseDown(sender, e);
        }

        /// <summary>
        /// Called when [mouse move].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        public override void OnMouseMove(object sender, MouseEventArgs e)
        {
            base.OnMouseMove(sender, e);
            this.m_Selector.OnMouseMove(sender, e);
        }

        public override void OnPaint(object sender, PaintEventArgs e)
        {
            this.m_Selector.OnPaint(sender, e);
        }
        #endregion Events
    }
}
